<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>添加用户组</title>
    <link rel="stylesheet" href="static/layui/css/layui.css">
<!--    <link rel="stylesheet" href="static/css/style.css">-->
    <style>
        body{background-color: white}
        .layui-form-label{
            width: 100px;
        }
        .layui-input-block {
            margin-left: 130px;
            min-height: 36px
        }
    </style>
</head>
<body class="body">
<!--templates/insert/yhzxxgl-->
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>添加用户组</legend>
</fieldset>

<form class="layui-form layui-from-pane" action="/Insertyhzxxgl" style="margin-top:20px" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label">用户组名称：</label>
        <div class="layui-input-block">
            <input type="text" name="title"  required  lay-verify="required" autocomplete="off" placeholder="请输入用户组名称" class="layui-input" style="width: 90%">
        </div>
    </div>

    <div class="layui-form-item" style="margin-top:40px">
        <div class="layui-input-block">
            <button class="layui-btn  layui-btn-submit " lay-submit="" lay-filter="demo1">添加</button>
        </div>
    </div>
</form>
<script src="static/layui/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form','layer','jquery'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,$=layui.jquery,
            table= layui.table
        //监听提交
        form.on('submit(demo1)', function(data){
            $.ajax({
                url:'/Insertyhzxxgl',
                type:'POST',
                dataType:'json',
                data:{title:data.field.title},
                success:function (msg) {
                    if(msg){
                        layer.closeAll('loading');
                        layer.load(2);
                        layer.msg("添加成功", {icon: 6});
                        setTimeout(function(){
                            window.parent.location.reload();//修改成功后刷新父界面
                        }, 1000);
                        //加载层-风格

                    }else{
                        layer.msg("已经存在该用户组,不支持重复添加", {icon: 5});
                    }
                }
            })
            return false;
        });
    });
</script>
</body>
</html>